package com.qys.livesMall.app.user.model.dto.sys;

import com.qys.livesMall.framework.view.BaseQuery;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @menu UserQuery
 * @date 2023/10/30 16:00
 */
@Data
public class UserQuery extends BaseQuery {

    @Schema(description = "用户显示Id（用户账号）")
    private String userRandomId;

    @Schema(description = "用户名")
    private String userName;

    @Schema(description = "昵称")
    private String nickName;

    @Schema(description = "状态")
    private Integer userStatus;

    @Schema(description = "用户系统类型（0：水军，1：正常用户）")
    private Integer userSysType;


    @Schema(description = "ip地址")
    private String ip;

    @Schema(description = "上级用户（用户账号）")
    private String supUserName;

    @Schema(description = "代理用户（用户账号）")
    private String poxUserName;

    @Schema(description = "手机号")
    private String phone;

    @Schema(description = "邮箱")
    private String email;

    @Schema(description = "邀请码")
    private String inviteCode;

    @Schema(description = "用户等级")
    private Integer userLevelId;

    @Schema(description = "层级")
    private Integer storey;



    /**
     * 用户ID集合
     */
    private List<String> userIds;

    private List<Long> longUserIds;

    public void setUserIds(List<String> userIds){
        this.userIds=userIds;
        if (CollectionUtils.isNotEmpty(userIds)){
            this.longUserIds=userIds.stream().map(Long::valueOf).collect(Collectors.toList());
        }else if (userIds!=null&&userIds.size()==0){
            this.longUserIds=new ArrayList<>();
        }else {
            this.longUserIds=null;
        }
    }
}

